assert_that(p1.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(""));
})
+
+test!(git_dep_build_cmd {
+ let p = git_repo("foo", |project| {
+ project.file("Cargo.toml", r#"
+ [project]
+
+ name = "foo"
+ version = "0.5.0"
+ authors = ["wycats@example.com"]
+
+ [dependencies.bar]
+
+ version = "0.5.0"
+ path = "bar"
+
+ [[bin]]
+
+ name = "foo"
+ "#)
+ .file("src/foo.rs",
+ main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
+ .file("bar/Cargo.toml", r#"
+ [project]
+
+ name = "bar"
+ version = "0.5.0"
+ authors = ["wycats@example.com"]
+ build = "cp src/bar.rs.in src/bar.rs"
+
+ [lib]
+
+ name = "bar"
+ "#)
+ .file("bar/src/bar.rs.in", r#"
+ pub fn gimme() -> int { 0 }
+ "#)
+ }).assert();
+
+ assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
+ execs().with_status(0));
+
+ assert_that(
+ cargo::util::process(p.bin("foo")),
+ execs().with_stdout("0\n"));
+
+ // Touching bar.rs.in should cause the `build` command to run again.
+ let mut file = fs::File::create(&p.root().join("bar/src/bar.rs.in")).assert();
+ file.write_str(r#"pub fn gimme() -> int { 1 }"#).assert();
+ drop(file);
+
+ assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
+ execs().with_status(0));
+
+ assert_that(
+ cargo::util::process(p.bin("foo")),
+ execs().with_stdout("1\n"));
+})
+